#!/bin/bash
#############
#Date 2022/6/28
#mail it-arch
#############
echo "##########################################"
echo "Auto Install Lighttpd                   ##"
echo "Press Ctrl + C to cancel                ##"
echo "Any key to continue                     ##"
echo "##########################################"
read -n 1
/etc/init.d/iptables status >/dev/null 2>&1
if [ $? -eq 0 ]
then
iptables -I INPUT -p tcp --dport 80 -j ACCEPT && 
iptables-save >/dev/null 2>&1
else
    echo -e "\033[32m iptables is stopd\033[0m"
fi
sed -i "s/SELINUX=enforcing/SELINUX=disabled/"  /etc/selinux/config
setenforce 0
#######################################
if [ -d /tools ];then
    cd /tools
else
    mkdir /tools && cd /tools
fi
yum -y install wget  gcc
yum groupinstall "Development tools" -y
wget -c -O /tools/lighttpd http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.41.tar.gz
yum -y install gcc pcre-devel zlib-devel vim bzip2-devel
cd /tools/
tar zxvf lighttpd
cd lighttpd-1.4.41
./configure --prefix=/usr/local/lighttpd
make && make install 
/etc/init.d/lighttpd start
echo -e "\033[32m Lighttpd install success\033[0m"
netstat -lntup | grep lighttpd

